﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace UdrinkWater_Project.Officer
{
    public partial class DetailOrder : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
           
        }
        

        protected void ASPxGridView1_RowCommand(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewRowCommandEventArgs e)
        {
            if (e.CommandArgs.CommandName == "Cmd_Select")
            {
                Session["Date"] = ConvestToDate(e.CommandArgs.CommandArgument.ToString());
                Session["Time"] = ConvestToTime(e.CommandArgs.CommandArgument.ToString());
                Session["GuestEmp"] = "false";
                Response.Redirect("BillOnline.aspx");
            }
        }
        public string ConvestToDate(string s)
        {
            string day = "";
            string mount = "";
            string yearstime = "";
            string years = "";
            string Times = "";
            try
            {
                string[] stemp = s.Split('/');
                day = (stemp[0]);
                mount = (stemp[1]);
                yearstime = (stemp[2]);
                string[] Time = yearstime.Split(' ');
                years = (Time[0]);
                Times = (Time[1]);
                if (Convert.ToInt32(years) > 2300)
                {
                    years = (Convert.ToInt32(years) - 543).ToString();
                }

                return (years + "-" + mount + "-" + day);
            }
            catch (Exception)
            {

            }
            return (years + "-" + mount + "-" + day);
        }
         public string ConvestToTime(string s)
        {
            string day = "";
            string mount = "";
            string yearstime = "";
            string years = "";
            string Times = "";
            try
            {
                string[] stemp = s.Split('/');
                day = (stemp[0]);
                mount = (stemp[1]);
                yearstime = (stemp[2]);
                string[] Time = yearstime.Split(' ');
                years = (Time[0]);
                Times = (Time[1]);
                if (Convert.ToInt32(years) > 2300)
                {
                    years = (Convert.ToInt32(years) - 543).ToString();
                }

                return (Times);
            }
            catch (Exception)
            {

            }
            return (Times);
        }
    }
}